public class Exercise {
    // 成员变量
    private String question; // 题目
    private String[] options; // 选项
    private int correctAnswer; // 正确答案的索引

    // 构造函数
    public Exercise(String question, String[] options, int correctAnswer) {
        this.question = question;
        this.options = options;
        this.correctAnswer = correctAnswer;
    }

    // 成员函数
    public void displayQuestion() {
        System.out.println(question);
    }

    public void displayOptions() {
        for (int i = 0; i < options.length; i++) {
            System.out.println((i + 1) + ". " + options[i]);
        }
    }

    public boolean checkAnswer(int answer) {
        return answer == correctAnswer + 1;
    }

    public int getCorrectAnswer() {
        return correctAnswer + 1; // 返回正确答案的索引（用户视角）
    }
}